/*
 * ====================================================================
 *
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 */

package com.tm.action.feixin.impl;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
 * This example demonstrates how to create secure connections with a custom SSL
 * context.
 */
public class ClientCustomSSL {

    public final static void main(String[] args) throws Exception {
    	int max = 3;
    	int[] returnVal = new int[max];
    	
    	List list = new ArrayList<String>();
    	list.add("1");
    	list.add("1");
    	list.add("1");
    	list.add("1");
    	list.add("3");
    	list.add("3");
    	Iterator<String> it = list.iterator();
    	while(it.hasNext()){
    		String temp = it.next();
    		for (int i=1; i<=max; i++) {
        		if (temp.equals(String.valueOf(i))) {
        			returnVal[i-1]++;
        		}
        	}
    	}
    	StringBuilder sb = new StringBuilder();
    	sb.append("[");
    	for(int i=0; i<max; i++){
    		sb.append(returnVal[i]);
    		if (i != max - 1) {
    			sb.append(", ");
    		}
    	}
    	sb.append("]");
    	System.out.println(sb.toString());

    }
    
    public String getDay(String time) throws ParseException {
    	SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd");
    	Date d = timeFormat.parse(time);
    	SimpleDateFormat dayFormat = new SimpleDateFormat("d");    
    	return dayFormat.format(d);
    }

}
